<style type="text/css">
.ui-datepicker{ z-index: 1031 !important; }
.table thead tr th,.table tbody tr td,.table tbody tr th{
    text-align: center;
}
</style>
<div id="content">
    <link href="/media/vendor/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
    <script src="/media/vendor/js/jquery-1.10.2.js"></script> 
    <script src="/media/vendor/js/jquery.ui.datepicker-zh-TW.js"></script> 
    <script src="/media/vendor/js/jquery-ui-1.10.4.custom.js"></script> 
    <script src="/media/js/leadtime/salessearchshow.js"></script> 
    <!-- 
    <script src="/media/js/highcharts.js"></script> 
    <script src="/media/vendor/artdialog/jquery.artDialog.js"></script>
    <link rel="stylesheet" href="/media/vendor/artdialog/skins/default.css" type="text/css" media="all">
    <script src="/media/vendor/artdialog/jquery.artDialog.js"></script> 
    <script src="/media/js/jquery.json-2.4.js"></script> -->
    <div id="formSearch" class="form-horizontal">
        <form action="/salessearchshow" method="GET">
            <div style="margin-bottom:10px; display: inline-block;">
                <span class="asd" for="input01">sku</span>
                <input style=" width:164px; margin-right:10px;" type="text" class="input-xlarge sku" name="skuName" autocomplete="off" value="<?php echo htmlspecialchars(isset($_GET['skuName']) ? $_GET['skuName'] : '', ENT_QUOTES, 'UTF-8'); ?>">
                <select name="sales">
                    <option value="ebay" <?php echo $_GET['sales'] === 'ebay' ? 'selected' : ''; ?> >ebay</option>
                    <option value="wish" <?php echo $_GET['sales'] === 'wish' ? 'selected' : ''; ?> >wish</option>
                    <option value="smt" <?php echo $_GET['sales'] === 'smt' ? 'selected' : ''; ?> >速卖通</option>
                    <option value="amz" <?php echo $_GET['sales'] === 'amz' ? 'selected' : ''; ?> >亚马逊</option>
                </select>
                <span class="asd" for="input01">日期</span>
                <input class="input-medium" style="width:200px;" type="text" value="<?php echo isset($_GET['minDate']) ? $_GET['minDate'] : ''; ?>" name="minDate" id="date_from">
                <span class="asd" for="input01">~</span>
                <input class="input-medium" style="width:200px;" type="text" value="<?php echo isset($_GET['maxDate']) ? $_GET['maxDate'] : ''; ?>" name="maxDate" id="date_to">
            </div>
            <div style="margin-bottom:10px; display: inline-block;">
                <label style="display: inherit;">
                    SKU模糊查询
                    <input type="checkbox" class="input-xlarge" name="skuLike" value="F" <?php echo empty($_GET['skuLike']) ? '' : 'checked'; ?>>
                </label>
                <button style="margin-left:10px;" class="btn btn-info" type="submit">查询</button>
                <button class="btn btn-inverse" type="reset">重置</button>
            </div>
        </form>
        <div id="container"></div>
        <?php 
        if( isset($dataList) ) {
        ?>
            <table id="paging" class="table table-responsive">
                <thead>
                    <tr style=" background-color:#4EA392; color:#fff;">
                        <th style="width: 30%"> SKU </th>
                        <th style="width: 30%"> 商品名 </th>
                        <th style="width: 20%"> 销量 </th>
                        <th style="width: 20%"> 详细 </th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $cacheSku = array();
                    foreach($dataList as &$v) {
                        $cacheSku[$v['sku']] = &$v['sku'];
                    }
                    $temp = json_decode(skusystemapi::getMoreSkuCnname('("' . join('", "', $cacheSku)  . '")'), true);  //无可奈何的写法
                    $cacheSku = array();
                    if( $temp ) {
                        foreach($temp as &$v) $cacheSku[$v['sku']] = &$v['name'];
                    }

                    foreach($dataList as $k => &$v) {
                        echo "<tr>
                            <td> {$v['sku']} </td>
                            <td> {$cacheSku[$v['sku']]} </td>
                            <td> {$v['sum']} </td>
                            <th> <a href='#' onclick='salessearchshowObj.showDetails(\"{$v['sku']}\"); return false;'>查看</a> </th>
                        </tr><tr><td id='{$v['sku']}Details' colspan=4 style='display: none;'></td></tr>";
                    }
                    ?>
                </tbody>
            </table>
        <?php
            echo $pagination;
        }
        ?>
    </div>
</div>